/**
 * Created by luyon on 17/8/22.
 */


"use strict";

//=========================
// 引入子组建和子组建reducer
//=========================

import { combineReducers } from "redux" ;
import { FilmCreatorReducers, CHANGE_CREATOR } from "./FilmCreator/FilmCreatorRedux" ;
import { FilmCommentReducers,CHANGE_COMMENT } from "./FilmComment/FilmCommentRedux" ;
import { FilmCommentTwoReducers,CHANGE_COMMENTTWO } from "./FilmComment/FilmCommentTwoRedux" ;

import {FilmVideoReducers,CHANGE_VIDEO} from "./FilmVideo/FilmVideoRedux";
import {OtherFilmsReducers,CHANGE_OTHER_FILMS} from "./OtherFilms/OtherFilmsRedux";
import {FilmDescriptionReducers,CHANGE_DESCRIPTION} from "./FilmDescription/FilmDescriptionRedux";
import {FilmDescriptionLogoReducers,CHANGE_LOGO} from "./FilmDescription/FilmDescriptionLogoRedux";
import {ReplyReducers, REPLY} from "./FilmComment/FilmCommentOne/ReplyRedux";

export const FilmDetailReducers = combineReducers({
    filmCreator         :       FilmCreatorReducers ,
    filmComment         :       FilmCommentReducers ,
    filmCommentTwo         :       FilmCommentTwoReducers ,

    filmVideo           :       FilmVideoReducers,
    otherFilms           :      OtherFilmsReducers,
    filmDescription     :       FilmDescriptionReducers,
    logo            :       FilmDescriptionLogoReducers,
    replyList         :ReplyReducers,

}) ;

export const mapStateToProps = state =>{
    return {
        filmDetailDescription: state.app.filmDetail.filmDescription,
        detailOtherFilms : state.app.filmDetail.otherFilms,
        allReply:state.app.filmDetail.replyList,

    }
} ;

export const mapDispatchToProps = dispatch =>{
    return{
        initialCreator      : (data)=>{dispatch({type:CHANGE_CREATOR,data:data})} ,
        initialComment      : (data)=>{dispatch({type:CHANGE_COMMENT,data:data})} ,
        initialCommentTwo      : (data)=>{dispatch({type:CHANGE_COMMENTTWO,data:data})} ,

        initialVideo        : (data)=>{dispatch({type:CHANGE_VIDEO,data:data})},
        initialOtherFilms   : (data)=>{dispatch({type:CHANGE_OTHER_FILMS,data:data})},
        initialDescription  : (data)=>{dispatch({type:CHANGE_DESCRIPTION,data:data})},
        initialLogo  : (data)=>{dispatch({type:CHANGE_LOGO,data:data})},
        initialFuifu:(e)=>{dispatch({type:REPLY,data:e})}

    }
} ;

